Skip to content

Add use cases. Refactor WebIDL. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 14, 2017
Merged

Add use cases. Refactor WebIDL. #7

merged 5 commits into from
Mar 14, 2017

Conversation

zolkis
Copy link
Contributor

@zolkis zolkis commented Mar 6, 2017

WebIDL was updated based on comments in #3.
Added some of the use cases mentioned in #6.

index.html Outdated
<li>Start the exposed <a>Thing</a> in order to process external requests.</li>
<li>Modify the handling of an external request to retrieve the <a>Thing Description</a>.</li>
<li>React on a property change</li>
<li>Register an action triggered by external retrieve requests on the <a>Thing Description</a>.</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid confusion with the interacion pattern "action" (of a thing) , could we say "a callback" or "logic"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could use something different. Originally I've used "hook", since it serves a special purpose (server side code executed before/after the implementation invokes an action registered by a client).

However, I have deliberately changed it to "action", since the signature may be the same as for registering an action, and shouldn't it be part of the TD like Actions are?

So if we use a different word, e.g. "hook", it needs to be added to the interaction list, together with Actions, Properties and Events.

Another question: could we model this use case with special events that are triggered locally by a property change or action invocation?

And finally, as also asked in the issue: is there an other way to fulfill the use case?

index.html Outdated
<li>Start the exposed <a>Thing</a> in order to process external requests.</li>
<li>Modify the handling of an external request to retrieve the <a>Thing Description</a>.</li>
<li>React on a property change</li>
<li>Register an action triggered by external retrieve requests on the <a>Thing Description</a>.</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid confusion with the interacion pattern "action" (of a thing) , could we say "a callback" or "logic"?

@zolkis
Copy link
Contributor Author

zolkis commented Mar 10, 2017

What about the following:

  • for request handlers we use single callback (to handle requests like retrieve TD, run Action, add Event listener, etc)
  • for hooks we use built-in events, like on("actionrequest"), `on("propertychangerequest") to which multiple listeners can be attached. In the use case, we can use the term "observe", like "Observe requests for invoking an action", and "Observe a request for property change". The effect is that after a property is changed or an action is invoked, listeners are notified in order to update their business logic.

However, I still fail the understand the use case for the hooks. These hooks are only used by the same script that defines the server Thing. Why cannot the logic that goes into the hooks go directly into the request handlers?

@zolkis zolkis mentioned this pull request Mar 10, 2017
@zolkis
Copy link
Contributor Author

zolkis commented Mar 10, 2017

I have reformulated the use cases and moved all observation use cases to consumed Thing. The misunderstanding probably came from the fact that ExposedThing also implements ConsumedThing and in the Current Practices they are just dumped together.

@zolkis
Copy link
Contributor Author

zolkis commented Mar 10, 2017

@knimura @h0ru5 could you review again, please

@zolkis
Copy link
Contributor Author

zolkis commented Mar 10, 2017

Added request handlers to ExposedThing and consolidated use of dictionaries for properties, actions and events.

@zolkis
Copy link
Contributor Author

zolkis commented Mar 14, 2017

Based on this comment I am merging for now. If there is feedback, let's raise them later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants